package yzserver.sx4a;

import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import yzserver.sx4a.form.Ret;

/**
 * Created with IntelliJ IDEA.
 * User: andrew
 * Date: 14-8-18
 * Time: 下午1:41
 * To change this template use File | Settings | File Templates.
 */
@Aspect
public class SXTransAspect {

    @AfterReturning(value = "execution(yzserver.sx4a.form.Ret yzserver.sx4a.*.*.*(*))",
            returning = "ret")
    public void excute(final Ret ret) throws Throwable {
        if(ret!=null && "false".equals(ret.getCode())){
            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
        }
    }
}
